package com.xbongbong.pro.domain.dao;

import com.xbongbong.pro.domain.entity.FineClueConsumptionEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/***
 *  精线索用量dao
 *
 * @return
 * @author hongxiao
 * @date 2021-12-29 23:23
 */

@Mapper
@Repository
public interface FineClueConsumptionDao {
    Integer insert(FineClueConsumptionEntity entity);

    void insertBatch(List<FineClueConsumptionEntity> list);

    FineClueConsumptionEntity getByKey(@Param("key") Long key, @Param("corpid") String corpid );

    Integer update(FineClueConsumptionEntity entity);

    void updateBatch(@Param("list") List<FineClueConsumptionEntity> list, @Param("corpid") String corpid);

    List<FineClueConsumptionEntity> findEntitys(@Param("param") Map<String, Object> param);

    Integer getEntitysCount(@Param("param") Map<String, Object> param);

    FineClueConsumptionEntity getByPid(@Param("corpid") String corpid, @Param("pid") String pid, @Param("source") Integer source);

    /**
     * 通过数据ids获取三方数据id
     *
     * @param corpid 公司id
     * @param dataIdIn 数据ids
     * @param businessType 业务类型
     * @param status 状态
     * @return
     */
    List<String> getPidsByDataIdIn(@Param("corpid") String corpid, @Param("dataIdIn") List<Long> dataIdIn, @Param("businessType") Integer businessType, @Param("status") Integer status, @Param("source") Integer source);

    /**
     * 更新用量表中三方数据状态
     *
     * @param corpid 公司id
     * @param pids 三方数据ids
     * @param status 状态
     * @return
     */
    Integer updateStatusByPids(@Param("corpid") String corpid, @Param("pids") List<String> pids, @Param("status") Integer status, @Param("source") Integer source);

    /**
     * 获取所有公司id
     *
     * @return
     */
    List<String> getCorpidList();

    List<FineClueConsumptionEntity> getPidsByDataIdEmpty(@Param("corpid") String corpid);
}